package de.tum.se.sudoku.gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import de.tum.se.sudoku.impl.Grid;
import de.tum.se.sudoku.impl.VariableCell;

public class SudokuComboBoxListener implements ActionListener {
	private Grid grid;
	private int row;
	private int col;

	public SudokuComboBoxListener(Grid grid, int row, int col) {
		super();
		this.grid = grid;
		this.row = row;
		this.col = col;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		SudokuComboBox selected = (SudokuComboBox) e.getSource();
		grid.setCell(row, col,
				new VariableCell(((Integer) selected.getSelectedItem())));
		// debug:
		grid.printGrid();
	}

}
